Skip to content

AWS connections: trust the install's own account, release-pinned templates, and a live permissions check with a one-click update - #323

Merged
nambok merged 1 commit into
mainfrom
fix/selfhost-integrations
Oct 27, 2026
Merged

nambok merged 1 commit into
mainfrom
fix/selfhost-integrations

Conversation

@nambok

@nambok nambok commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Connected AWS accounts on a self-hosted install now trust the install's own account and use the install's own release's templates. Every account, hosted or self-hosted, gets a live check of this release's read-only permissions with a one-click update. Paired with the dashboard PR (CoderHelm/coderhelm, same branch name).

Changes

  • public_urls::platform_account_id: on self-host, "" instead of the hosted account when CODERHELM_ACCOUNT_ID is missing; cfn-url then refuses with a plain fix.
  • common::log_reader: the role and update templates built into the release (include_str!), the abilities with their IAM actions and why, the permission set's id, the Launch Stack and update links, and a template download with the install's account filled in. Tests keep the code's action list equal to both templates' actions and every action read-only.
  • infra/cfn: TrustedRolePrefix plus an aws:PrincipalArn condition (the self-host link narrows trust to <prefix>-* roles); iam:SimulatePrincipalPolicy on the role itself. New coderhelm-log-reader-update.yaml: one policy per update stack (CoderHelmLogReaderUpdate-<id>).
  • Release workflow: both templates go into the release, SHA256SUMS and attestation, and are written once to launch/<tag>/ (the publisher role already allows launch/*). A self-hosted release defaults LOG_READER_TEMPLATE_URL to that copy; RESOURCE_PREFIX is set on the services.
  • common::live::permissions: a live check through IAM's policy simulator on the role (it names a permissions boundary or an SCP), falling back to one read of each kind for older roles. After Update is pressed, it looks for the update stack and names the problem: failed, in progress, not found in the role's account, or not added yet.
  • Gateway: POST /api/aws-connections/:id/permissions/check, GET /api/aws-connections/template, a richer cfn-url (account, prefix, grouped actions). The integrations card says "Update needed: N new read-only permissions". The old metrics/Airflow add-on link is replaced by the update stack.
  • Worker: a daily aws_permissions_sweep (EventBridge rule) saves each account's check and tells each team once per permission set in Slack/Teams. The log fix evidence step names refused reads ("skipped, update in one click") and keeps working.
  • Setup check aws_connections: the install knows its account; the role and update templates it links to are this release's.
  • Docs: docs/self-host/integrations.md rewritten per integration (what you need, how to connect on self-host, what changes with hybrid; definition lists), config-reference.md, check-your-install.md.

Verification

  • cargo fmt --check, cargo clippy --workspace -- -D warnings, cargo test --workspace (common 1067, gateway 696, worker 512, no_hosted_urls).
  • infra npm test (70): new synth tests for the install's own account, the release-pinned template, RESOURCE_PREFIX, the IAM to take on the role, and release publishing.
  • installer npm test, lambda/tests, selfhost/launch tests, actionlint, check_workflows.py.
  • Dashboard e2e with a self-host runtime config covers the flow end to end (paired PR).

…lates, and a live permissions check with a one-click update

- A self-hosted install never falls back to CoderHelm's AWS account: without
  CODERHELM_ACCOUNT_ID it refuses to make the role link and Setup checks fail.
- The role and update templates are built into each release and published
  under launch/<version>/; a self-hosted install links to its own release's
  copy, and the role can be downloaded with the install's account filled in.
- On self-host the role's trust is narrowed to the install's own roles
  (aws:PrincipalArn, TrustedRolePrefix).
- Each connection is checked live against this release's permissions (IAM
  policy simulator on the role, or one read of each kind), with a one-click
  update stack per permission set and plain reasons when it fails.
- A daily sweep tells each team once per new permission set; the log fix
  evidence step names refused reads and keeps working.
- aws_connections setup check; self-host integrations docs rewritten.
@nambok
nambok merged commit 3ec296c into main Oct 27, 2026
8 checks passed
@nambok
nambok deleted the fix/selfhost-integrations branch October 27, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant